mui.init();
mui.plusReady(function() {
	var user_token = plus.storage.getItem('cg_user_token'),
		temp_name = plus.storage.getItem('cg_nickname'),
		user_id = plus.storage.getItem('cg_user_id'),
		curr_webview = plus.webview.currentWebview(),
		remark = temp_name ? ('我是' + temp_name) : '',
		to_user_id = curr_webview.to_user_id;
	$('.check-info').text(remark);
	$('.btn-add').on('tap', function() {
		remark = $('.check-info').text();
		myAjax('addresslist/front_user_relation/addNewRelation', 'post', {
			'user_id': user_id,
			'user_token': user_token,
			'remark': remark,
			'to_user_id': to_user_id
		}, function(data) {
			if(data.success) {
				mui.alert('消息发送成功', '提示', function() {
					mui.openWindow('friend_add_header.html');
				});
			} else if(data.error_code == '30004') {
				mui.alert('您已发送请求，请耐心等待', '提示');
			} else if(data.error_code == '30003') {
				mui.alert('您已发送请求，请耐心等待', '提示');
			} else {
				mui.alert('发送好友请求失败,请重新发送', '提示');
			}
		});
	});
});